public class TestDemo {
    public static int fac(int n) {
        int ret = 1;
        for (int i = 1; i <= n; i++) {
            ret *= i;
        }
        return ret;
    }

    public static int facSum(int x) {
        int sum = 0;
        for (int i = 1; i <= x; i++) {
            int tmp = fac(i);
            sum = sum + tmp;
        }
        return sum;
    }


    //递归函数
    public static void main(String[] args) {
        int ret = facSum(5);
        System.out.println(ret);
    }
}
class TestDemo1 {
    public static void func(int n) {
        if (n == 1) {
            System.out.println(n);
            return;
        }
        func(n - 1);
        System.out.println(n);
    }
public static int fac(int n){
        if(n==1){
            return 1;
        }
        int tmp=n*fac(n-1);
        return tmp;
}
    public static void main(String[] args) {
        System.out.println(fac(5));
    }
}
